<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page import="java.util.ArrayList"%>
<%@ page import="com.dao.GoodsCtrl"%>
<%@ page import="com.dao.CatalogCtrl"%>
<%@ page import="com.dao.StoreCtrl"%>
<%@ page import="com.entity.Goods"%>
<%@ page import="com.entity.Catalogue"%>
<%@ page import="com.entity.Store"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="keywords" content="" />
		<meta name="description" content="" />
<title>库存管理</title>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
		<script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/global.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/modal.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div id="header">
			<div class="col w5 bottomlast">
				<a href="" class="logo">
					<img src="images/logo.gif" alt="Logo" />
				</a>
			</div>
			<div class="col w5 last right bottomlast">
				<p class="last">用户名 <span class="strong">Admin,</span> <a href="">注销</a></p>
			</div>
			<div class="clear"></div>
		</div>
		<div id="wrapper">
			<div id="minwidth">
				<div id="holder">
					<div id="menu">
						<div id="left"></div>
						<div id="right"></div>
						<ul>
							<li>
								<a href="index.jsp" class="selected"><span>库存管理</span></a>
							</li>
							<li>
								<a href="newGood.jsp" ><span>新建库存</span></a>
							</li>
							<li>
								<a href="checkOrder.jsp"><span>查看领用单</span></a>
							</li>
						</ul>
						<div class="clear"></div>
					</div>
					<div id="submenu">
						<div class="title">
							编辑库存
						</div>
						<div class="modules_right">
							<div class="module search">
								<form action="">
									<p><input type="text" value="Search..." name="user_search" /></p>
								</form>
							</div>
						</div>
					</div>
					<div id="desc">
						<div class="body">
							<div class="col w10 ">
								<div class="content">
								<div id="form" class="help">
							
							<div class="col w10">
								<div class="content">
								<div class="box">
<form name='form1' method='post' action="EditGoodsServlet">
<table border='0'>
    
        <%                        
         int goods_id=Integer.parseInt(request.getParameter("goods_id"));
       // int goods_id=1;
         
       GoodsCtrl gc = new GoodsCtrl();
         Goods thisGoods=gc.selGoods(goods_id);
         
          String goods_name=thisGoods.getGoods_name();
          int catalog_id=thisGoods.getCatalog_id();
          String catalog_name=gc.findByCatalogId(catalog_id);
          String goods_type=thisGoods.getGood_type();
          int amount=thisGoods.getAmount();
          int min_amount=thisGoods.getMin_amount();
          String position=thisGoods.getPosition();
          int property_id=thisGoods.getProperty_id();
          String sn_id=thisGoods.getSn_id();
          
          
         %>
          <tr>
		<td><label for="simple_input">ID</label></td>
		<td><input  type="text" readonly name='goods_id' id='goods_id' class="text w_20" value='<%=goods_id%>'></td>		
	</tr>
         <tr>
		<td><label for="simple_input">名称</label></td>
		<td><input type='text' name='goods_name' id='goods_name' class="text w_20" value='<%=goods_name %>'></td>		
	</tr>
	<tr>
		<td><label for="simple_input">分类</label></td>
		<td>
		
<select name="catalog_id" id="catalog_id" >
				<%
				CatalogCtrl cc= new CatalogCtrl();
				ArrayList<Catalogue> catalogList = cc.getCatalog();
				if(catalogList==null)
				{
					catalogList=new ArrayList<Catalogue>();
				}
				int num = catalogList.size();
				for(int i =0; i<num; i++){
				int _catalog_id = catalogList.get(i).getCatalog_id();
				String _catalog_name= catalogList.get(i).getCatalog_name();
				%>
	<option id=<%=_catalog_id%>  value=<%=_catalog_id %> <%=_catalog_name.equals(catalog_name)?"selected":"" %> > <%=_catalog_name %> </option>
				<%} %>
</select>		
		</td>		
	</tr>
	<tr>
		<td><label for="simple_input">型号</label></td>
		<td><input type='text' name='goods_type' id='goods_type' class="text w_20" value='<%=goods_type %>'></td>		
	</tr>
	<tr>
		<td><label for="simple_input">数量</label></td>
		<td><input type='text' name='amount' id='amount' class="text w_20" value='<%=amount %>'></td>		
	</tr>
	<tr>
		<td><label for="simple_input">最小数量</label></td>
		<td><input type='text' name='min_amount' id='min_amount' class="text w_20" value='<%=min_amount%>'></td>	
	</tr>
	<tr>
		<td><label for="simple_input">位置</label></td>
		<td><input type='text' name='position' id='position' class="text w_20" value='<%=position%>'></td>	
	</tr>
	<tr>
		<td><label for="simple_input">资产编号</label></td>
		<td><input type='text' name='property_id' id='property_id' class="text w_20" value='<%=property_id%>'></td>	
	</tr>
	<tr>
		<td><label for="simple_input">S/N码</label></td>
		<td><input type='text' name='sn_id' id='sn_id' class="text w_20" value='<%=sn_id%>'></td>	
	</tr>
	
	<tr>		
		<td>
		
		<a href="" class="button form_submit"><small class="icon check"></small><span>确定</span><input type="submit" value="submit" class="novisible" /></a>
		
		</td>
        <td><a href="./index.jsp" class="button cross"><small class="icon cross"></small><span>取消</span></a>
        </tr>
</table>
									</form>
								</div>
								</div>
							</div>
																		

	
							<div class="clear"></div>
</div>
								</div>
								<div class="clear"></div>
							</div>
							<div class="clear"></div>
						</div>
						<div class="clear"></div>
						<div id="body_footer">
							<div id="bottom_left"><div id="bottom_right"></div></div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div id="footer">
			<p class="last"><a href=""></a></p>
		</div>
</body>
</html>